use super::super::entities::employee::Model;
use sea_orm::prelude::DateTime;
use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, Serialize)]
pub struct EmployeeLoginVo {
    pub id: i64,
    pub user_name: String,
    pub name: String,
    pub token: String,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct EmployeeVO {
    pub id: i64,
    pub name: String,
    pub username: String,
    pub phone: String,
    pub sex: String,
    pub id_number: String,
    pub status: i32,
    pub create_time: Option<DateTime>,
    pub update_time: Option<DateTime>,
    pub create_user: Option<i64>,
    pub update_user: Option<i64>,
}

impl From<Model> for EmployeeVO {
    fn from(employee: Model) -> Self {
        EmployeeVO {
            id: employee.id,
            name: employee.name,
            username: employee.username,
            phone: employee.phone,
            sex: employee.sex,
            id_number: employee.id_number,
            status: employee.status,
            create_time: employee.create_time,
            update_time: employee.update_time,
            create_user: employee.create_user,
            update_user: employee.update_user,
        }
    }
}
